<?php
/**
 * Albireo module
 *
 * @copyright  Copyright (c) 2010 Albireo Solutions
 * @package    Kernel
 */
namespace Celebrio\Database;

/**
 * interface for db modules served by dibi
 *
 * @author     Albireo Solutions
 * @package    Kernel
 */
interface IDatabase {

    /**
     * Returns the database syntactic expression for concatenation function.
     * For example, it looks like this:
     *
     *      $result = dbfConcat("'a'", "'b'");
     *
     * Variable $result might conatin something like "concat('a','b')" for
     * MySQL or "'a' || 'b'" for Postgres. You've got the idea.
     *
     * @abstract
     * @param string $first
     * @param string $second
     */
    function dbfConcat($first, $second);

    /**
     * Similar to dbfConcat, returns the database function for substring
     * containing the given parameters.
     *
     * @param string $string the string we want to get substring from
     * @param int $from the position of the character the substring begins
     *        (i guess the default indexing strings in databases is 1, so beware)
     * @param int $for the length of substring
     */
    function dbfSubstr($string, $from, $for = null);

    /**
     * Similar to dbfConcat, returns the database function for strlen,
     * i.e the function resulting the number of characters in the string.
     *
     * @param string $string the string we want to get the number of chars from
     */
    function dbfStrlen($string);
    
}